package com.jay.publisher.app.ui

import android.content.pm.ActivityInfo
import android.os.Bundle
import com.jay.publisher.app.R
import com.shuyu.gsyvideoplayer.GSYBaseActivityDetail
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.player.PlayerFactory
import com.shuyu.gsyvideoplayer.player.SystemPlayerManager
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import kotlinx.android.synthetic.main.activity_player.*
import tv.danmaku.ijk.media.exo2.Exo2PlayerManager


class PlayerActivity : GSYBaseActivityDetail<StandardGSYVideoPlayer>() {

    val source1 = "rtmp://192.168.0.108:1935/live/live"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_player)
        PlayerFactory.setPlayManager(Exo2PlayerManager::class.java)

        initVideoBuilderMode()
    }

    override fun getGSYVideoPlayer(): StandardGSYVideoPlayer {
        return videoPlayer
    }

    override fun getGSYVideoOptionBuilder(): GSYVideoOptionBuilder {
        return GSYVideoOptionBuilder()
                .setVideoTitle("测试视频直播")
                .setUrl(source1)
                .setCacheWithPlay(true)
                .setIsTouchWiget(true)
                .setRotateViewAuto(false)
                .setLockLand(false)
                .setShowFullAnimation(false) //打开动画
                .setNeedLockFull(true)
                .setSeekRatio(1f)
    }

    override fun clickForFullScreen() {
    }

    override fun getDetailOrientationRotateAuto(): Boolean {
        return true
    }
}